package com.ustc.hewei.snowflakemodule.segment;

import com.ustc.hewei.commonmodule.utils.SegmentID;
import com.ustc.hewei.nettyrpc2_0.common.annotation.RPCService;
import com.ustc.hewei.snowflakemodule.exception.InitException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author hewei
 * @version 1.0
 * @description: segment模式对外的实现
 * @date 2022/11/22 10:29
 */

@RPCService(value = SegmentID.class)
@Component
public class SegmentIdImpl implements SegmentID {
    @Autowired
    public SegmentWorker segmentWorker;

    @Override
    public long getId(String bizTag) {
        return segmentWorker.getId(bizTag).getId();
    }
}
